package com.qn.result;

import lombok.Data;

@Data
public class BaseResponse<T> {
    // 状态码
    public static final Integer SUCCESS = 200;
    public static final Integer FAIL = 500;
    // 消息
    private static final String SUCCESS_MESSAGE = "success";

    private Integer code;

    private String message;

    private T data;

    public BaseResponse(Integer code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public BaseResponse(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public BaseResponse(T data) {
        this.code = SUCCESS;
        this.message = SUCCESS_MESSAGE;
        this.data = data;
    }

}
